<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>Underscore</title>
	</head>
	<body>
		
		
		<script src="bower_components/underscore/underscore-min.js" type="text/javascript" charset="utf-8"></script>
		
		<script type="text/javascript">
			var arr = [1,2,3,4,5];
			var obj = {
				name: 'abc',
				age: 22,
				gender: '女'
			};
			var students = [
				{
					name: 'abc',
					age: 22,
					gender: '女'
				},
				{
					name: 'abcabc',
					age: 25,
					gender: '女'
				},
				{
					name: 'abc321',
					age: 64,
					gender: '女'
				},
				{
					name: 'abc123',
					age: 11,
					gender: '女'
				},
			];
			
			//查找
			var stu = _.find(students,function(item,index){
				return item.name = 'abc123';
			});
			//迭代增加
//			var sum = _.reduce([1,2,3],function(memo,num){
//				return memo + num;
//			},0);
			
//			var even = _.find(arr , function(num){
//				console.log(num);
//				return num % 2 ==0;
//			});
//			_.each(arr,function(item , index){
//				console.log(index);
//			})
			
//			_.each(obj,function(val , key){
//				console.log(key);
//			})

//			var opts = _.map(obj , function(val , key){
//				return '<option>'+val+'</option>'
//			});


			console.log(stu);

		</script>
		
	</body>
</html>
